<extend name="Public/base"/>

<block name="body">
	<div class="main-title">
		<h2>{$info['id']?'编辑视图':'新增视图'}表</h2>
	</div>
	<form action="{:U()}" method="post" class="form-horizontal">
	    <input type="hidden" name="vid" value="{$vid}" />
	    <input type="hidden" name="tid" value="{$tid}" />
	    <input type="hidden" name="tname" value="{$tname}" />
	    <input type="hidden" name="editid" value="{$editid}" />
		<div class="form-item">
			<label class="item-label">视图名</label>
			<div class="controls">
				<input type="text" class="text input-large" name="vname" value="{$viewForm.vname}">
			</div>
		</div>
		<div class="form-item">
			<label class="item-label">视图类型<span class="check-tips">（用于显示方式）</span></label>
			<div class="controls">
				<select name="vtype">
					<if condition="($viewForm.vtype eq 'list')">
						<option value="list" selected = "selected">列表</option>
					<else />
						<option value="list">列表</option>
					</if>
					<if condition="($viewForm.vtype eq 'view')">
						<option value="view" selected = "selected">查看(单条记录)</option>
					<else />
						<option value="view">查看(单条记录)</option>
					</if>
					<if condition="($viewForm.vtype eq 'form')">
						<option value="form" selected = "selected">表单</option>
					<else />
						<option value="form">表单</option>
					</if>
					<if condition="($viewForm.vtype eq 'share')">
						<option value="share" selected = "selected">共享</option>
					<else />
						<option value="share">共享</option>
					</if>
               </select>
			</div>
		</div>

		<div class="form-item">
			<div class="data-table table-striped">
				<table id="tbdata">
					<thead>
						<tr>
							<th>字段</th>
							<th>显示名</th>
							<th>使用项</th>
							<th>必填项</th>
							<th>只读项</th>
							<th>顺序</th>
							<th>字典</th>
							<th>共享视图</th>
						</tr>
					</thead>
					<tbody>
						<notempty name="viewList">
							<volist name="viewList" id="list">
						<tr>
							<td>
								{$list.fname}
							</td>
							<td>
								<input name='cname_{$list.fname}' type='text'  class="text" value="{$list.fnamec}"/>
							</td>
							<td>
								<if condition="($list.ispk eq 1) AND ($editid eq 1) ">
									<input name="use_{$list.fname}" checked type="checkbox"/>
								<else />
									<input name="use_{$list.fname}" type="checkbox"/>
								</if>
							</td>
							<td>
								<if condition="($list.isnotnull eq 1) AND ($editid eq 1) ">
									<input name="create_{$list.fname}" checked type="checkbox"/>
								<else />
									<input name="create_{$list.fname}" type="checkbox"/>
								</if>
							</td>
							<td>
								<if condition="($list.isreadonly eq 1) AND ($editid eq 1) ">
									<input name="readonly_{$list.fname}" checked type="checkbox"/>
								<else />
									<input name="readonly_{$list.fname}" type="checkbox"/>
								</if>
							</td>
							<td>
								<input name="order_{$list.fname}" type="text" value="{$list.indexorder}"/>
							</td>
							<td>
								<select name="dict_{$list.fname}">
									<option value=''></option>
									<notempty name="dicttable">
										<volist name="dicttable" id="dict">
											<if condition="$dict.id eq $list.vdic ">
												<option selected = "selected" value="{$dict.id}">{$dict.name}</option>
											<else />
												<option value="{$dict.id}">{$dict.name}</option>
											</if>
										</volist>
									</notempty>
								</select>
							</td>
							<td>
								<select name="share_{$list.fname}">
									<option value=''></option>
									<notempty name="sharetable">
										<volist name="sharetable" id="share">
											<if condition="$share.vid eq $list.shareview ">
												<option selected = "selected" value="{$share.vid}">{$share.vname}</option>
											<else />
												<option value="{$share.vid}">{$share.vname}</option>
											</if>
										</volist>
									</notempty>
								</select>
							</td>
						</tr>
							</volist>
						</notempty>
					</tbody>
				</table>
			</div>
		</div>
		<div class="form-item">
				<button class="btn submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal">确 定</button>
				<button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
		</div>
	</form>
</block>

<block name="script">
	<script type="text/javascript">

		//导航高亮
		highlight_subnav('{:U('Config/index')}');

	</script>
</block>
